#ifndef TILE_H
#define TILE_H

#include "Image.h"

struct TileRect
{
    int x, y, w, h;

    TileRect(): x(0), y(0), w(0), h(0){}

    TileRect(int set_x, int set_y, int set_w = 32, int set_h = 32)
        :
        x(set_x),
        y(set_y),
        w(set_w),
        h(set_h)
    {
    }



    inline bool contains(int _x, int _y)
    {
        return (
                _x > x && _y > y &&
                _x < x+w && _y < y+h
                );
    }
};

struct Tile
{
    int ID;

    bool placed;

    Image image;

    void SetImage(Image& Image)
    {
        image = Image;
    }


    void Render(int x =0, int y =0)
    {
        image.Render(x, y);
    }

    void Create(int id)
    {
        placed = false;
        ID = id;
    }

    bool Contains(int x, int y, int _x, int _y, int w = 32, int h = 32)
    {
        return (
                _x >= x && _x <= x+w &&
                _y >= y && _y <= y+h
                );
    }
};

#endif // TILE_H
